<template>
    <div style="text-align:center">
        <img class="mx-auto" alt="Vue logo" src="~frontend/src/assets/logo.png" />
        <h1>{{ msg }}</h1>
<!--        <n-button @click="showConfirmDialog">显示确认弹窗</n-button>-->
<!--        <n-button ghost type="warning" @click="openDevTools">打开控制台</n-button>-->
        <n-button @click="toMarkdown">markdown</n-button>
        <p>
            Recommended IDE setup:
            <a href="https://code.visualstudio.com/" target="_blank">VS Code</a>
            +
            <a href="https://github.com/johnsoncodehk/volar"
               target="_blank">Volar</a>
        </p>

        <p>See <code>README.md</code> for more information.</p>

        <p>
            <a href="https://vitejs.dev/guide/features.html" target="_blank">
                Vite Docs
            </a>
            |
            <a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
        </p>

        <button type="button" @click="count++">count is: {{ count }}</button>
        <p class="bg-green-50">
            Edit
            <code>components/HelloWorld.vue</code> to test hot module
            replacement.
        </p>
    </div>
</template>

<script lang="ts">
import {ref, defineComponent, computed, onMounted} from 'vue'
import {NButton}                                   from "naive-ui"
import {useRouter}                       from "vue-router";

export default defineComponent({
    components: {NButton},
    props: {
        msg: {
            type: String
        }
    },
    setup(props: Record<string, any>) {
        onMounted(() => {
        })

        // function showConfirmDialog() {
        //     dialog.confirm("确认提示框", "标题")
        // }

        const router = useRouter()

        function toMarkdown() {
            router.push({path: "/markdown"});
        }

        // function openDevTools(){
        //     tauriApi.event.emit("dev_tools");
        // }

        const count = ref(0)
        const msg = computed(() => props.msg)
        return {
            count,
            msg,
            // showConfirmDialog,
            toMarkdown,
            // openDevTools
        }
    }
})

</script>

<style scoped>
a {
    color: #42b983;
}

label {
    margin: 0 0.5em;
    font-weight: bold;
}

code {
    background-color: #eee;
    padding: 2px 4px;
    border-radius: 4px;
    color: #304455;
}
</style>
